﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>集中考试</title>

<link href="css/main.css" rel="stylesheet" type="text/css" />

<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jzkszx.js"></script>
<script>
function MaxMe(o) {
	if (window.navigator.userAgent.indexOf("Firefox") > -1) {
		o.style.height = o.scrollTop + o.scrollHeight + "px";
	}
	else {
		if (o.scrollTop > 0) o.style.height = o.scrollTop + o.scrollHeight + "px";
	}
}
</script>


</head>
<body>

<form id="form1" action="HandOnExam.aspx" method="post">
  <div class="clearfix"></div>
  <div class="mainbox box-center"> 
    
    <!--左侧-->
    <div class="side_l left"> 
      <!--信息-->
      <div class="col-l-01 box-shadow-ie-r"> <b class="b1"></b><b class="b2"></b><b class="b3 "></b>
        <div class=" bc bc-h01  box-shadow">
          <div class="text-left m5 col-r-03">
            <p>学员姓名：<span id="stuname">张翔</span></p>
            <p>卷面总分：<span id="totalscore">100.00</span>分</p>
          </div>
        </div>
        <b class="b3"></b><b class="b2"></b><b class="b1 "></b> </div>
      <!--序号-->
      <div class="col-l-02 box-shadow-ie-r mt20 bc-h02  "> <b class="b1"></b><b class="b2"></b><b class="b3 "></b>
        <div class=" bc  box-shadow p10">
          <div id="testnum" class="xuhao">
          
          </div>
        </div>
        <b class="b3"></b><b class="b2"></b><b class="b1 "></b> </div>
		<div class="toplogo">
    <div class="mainbox">
      <div class="but"><a class="btn02 png" onclick="UpExam();" href="#"></a></div>
    </div>
  </div>
    </div>
    <!--右侧--> 
    <!--题-->
    <div class="col-r-01 box-shadow-ie-r mt10 right"><b class="b1"></b><b class="b2"></b><b class="b3 "></b>
       <div id="Content1"></div>
       <div id="Content" class=" bc bc-h04  box-shadow p10">
        
       </div>
    </div>
  </div>
  <input name="txtTimer" type="hidden" id="txtTimer" />
  <input name="totaltime" type="hidden" id="totaltime" value="600" />
  <input name="endtime" type="hidden" id="endtime" value="2015-05-31 16:50:52" />
  <input name="HidhisID" type="hidden" id="HidhisID" value="185" />
</form>
</body>
</html>
<script>
    $(function () {
        var res = window.location.search;
        var resdata = res.split(",")
        if (res == "") {

        } else {
            if (resdata.length <= 1) {
                prourlid = resdata[0].split("=")[1];
                GetExam(prourlid)
                GetExamitem(prourlid)
            } else {
                alert("请先登录")
                this.location.href = "../index.html";
            }
           
        }  
       
        
    })

    function GetExam(id) {
       
        var obj = {};
        obj.id = id
        $.ajax({
            url: '../../../Course/GetCourse1',
            type: 'get',
            data: obj,
            dataType: 'json',
            contentType: 'application/json',
            async: false,
            success: function (data) {
                var resultData = data;
                var strA = "1";
                var strB = "2";
                var strC = "3";
                var strD = "4";
                var strE = "5";
                if (resultData != undefined && resultData.length!=0) {
                    var Str = "";
                    if (resultData[0].t1 != 0) {
                        Str += '<b class="b1 bb1"></b><b class="b2 bb2"></b><b class="b3 bb2"></b><div class="bc bb2" ><div class="bt bb3 bc-h03"><span><a><img class="png" src="images/jian.png" /></a></span>第一部分：  单选题（每题1.00分,共' + (resultData[0].t1 * 1) + '分）</div></div ><b class="b3 bb2"></b><b class="b2 bb2"></b><b class="b1 bb1"></b>';
                        for (var i = 0; i < Object.keys(resultData).length; i++) {
                            if (resultData[i].TopicType == 1 && resultData[0].t1 != 0) {
                                Str += '<div class="m-choicebox" ><a name="' + (i + 1) + '" class="target"></a><h4>第  ' + (i + 1) + '  题：<p>' + resultData[i].Topic + '(　)。</p><p><img alt="" src="' + resultData[i].Img + '" /></p></h4><ul class="single"><li class="question-option-list"><span>A．</span><div class="option-content">' + resultData[i].OptionA + '</div></li><li class="question-option-list"><span>B．</span><div class="option-content">' + resultData[i].OptionB + '</div></li><li class="question-option-list"><span>C．</span><div class="option-content">' + resultData[i].OptionC + '</div></li><li class="question-option-list"><span>D．</span><div class="option-content">' + resultData[i].OptionD + '</div></li><li class="question-option-list"><span>E．</span><div class="option-content">' + resultData[i].OptionE + '<br/><br /></div></li ></ul><div class="m-checkBox single"><a  class="question-btn  ' + resultData[i].Id + '" id="lblA' + resultData[i].Id + '" onclick="checkanswer(' + resultData[i].Id + ',' + resultData[i].TopicType + ',' + strA + ')"><label for="rdA' + resultData[i].Id + '"><input type="radio" value="A"  name="rd' + resultData[i].Id + '"  id="rdA' + resultData[i].Id + '" onclick="checkanswer(' + resultData[i].Id + ',' + resultData[i].TopicType + ',' + strA + ')" />&nbsp;&nbsp;A</label></a><a  class="question-btn  ' + resultData[i].Id + '" id="lblB' + resultData[i].Id + '"><label for="rdB' + resultData[i].Id + '"><input type="radio" value="B"  name="rd' + resultData[i].Id + '"  id="rdB' + resultData[i].Id + '" onclick="checkanswer(' + resultData[i].Id + ',' + resultData[i].TopicType + ',' + strB + ')" />&nbsp;&nbsp;B</label></a><a  class="question-btn  ' + resultData[i].Id + '" id="lblC' + resultData[i].Id + '"><label for="rdC' + resultData[i].Id + '"><input type="radio" value="C"  name="rd' + resultData[i].Id + '"  id="rdC' + resultData[i].Id + '" onclick="checkanswer(' + resultData[i].Id + ',' + resultData[i].TopicType + ',' + strC + ')" />&nbsp;&nbsp;C</label></a><a  class="question-btn  ' + resultData[i].Id + '" id="lblD' + resultData[i].Id + '"><label for="rdD' + resultData[i].Id + '"><input type="radio" value="D"  name="rd' + resultData[i].Id + '"  id="rdD' + resultData[i].Id + '" onclick="checkanswer(' + resultData[i].Id + ',' + resultData[i].TopicType + ',' + strD + ')" />&nbsp;&nbsp;D</label></a><a  class="question-btn  ' + resultData[i].Id + '" id="lblE' + resultData[i].Id + '"><label for="rdE' + resultData[i].Id + '"><input type="radio" value="E"  name="rd' + resultData[i].Id + '"  id="rdE' + resultData[i].Id + '" onclick="checkanswer(' + resultData[i].Id + ',' + resultData[i].TopicType + ',' + strE + ')" />&nbsp;&nbsp;E</label></a></div></div><div class="clearfix"></div>';
                            }
                        }
                    }
                    if (resultData[0].t2 != 0) {
                        Str += '<b class="b1 bb1"></b><b class="b2 bb2"></b><b class="b3 bb2"></b><div class="bc bb2" ><div class="bt bb3 bc-h03"><span><a ><img class="png" src="images/jian.png" /></a></span>第二部分：  多选题（每题2.00分,共' + (resultData[0].t2 * 2) + '分）</div></div ><b class="b3 bb2"></b><b class="b2 bb2"></b><b class="b1 bb1"></b>';
                        for (var i = 0; i < Object.keys(resultData).length; i++) {
                            if (resultData[i].TopicType == 2 && resultData[0].t2 != 0) {
                                Str += '<div class="m-choicebox" ><a name="' + (i + 1) + '" class="target"></a><h4>第  ' + (i + 1) + '  题：<p style="text-align:left;">' + resultData[i].Topic + '(　)。</p><p><img alt="" src="' + resultData[i].Img + '" /></p></h4><ul class="single"><li class="question-option-list"><span>A．</span><div class="option-content">' + resultData[i].OptionA + '</div></li><li class="question-option-list"><span>B．</span><div class="option-content">' + resultData[i].OptionB + '</div></li><li class="question-option-list"><span>C．</span><div class="option-content">' + resultData[i].OptionC + '</div></li><li class="question-option-list"><span>D．</span><div class="option-content">' + resultData[i].OptionD + '</div></li><li class="question-option-list"><span>E．</span><div class="option-content">' + resultData[i].OptionE + '<br/></div></li></ul><div class="m-checkBox single"><a  class="question-btn ' + resultData[i].Id + '" id="lblA' + resultData[i].Id + '"><label for="rdA' + resultData[i].Id + '"><input type="checkbox" value="A"  name="rd' + resultData[i].Id + '"  id="rdA' + resultData[i].Id + '" onclick="checkanswer(' + resultData[i].Id + ',' + resultData[i].TopicType + ',' + strA + ')" />&nbsp;&nbsp;A</label></a><a  class="question-btn ' + resultData[i].Id + '" id="lblB' + resultData[i].Id + '"><label for="rdB' + resultData[i].Id + '"><input type="checkbox" value="B"  name="rd' + resultData[i].Id + '"  id="rdB' + resultData[i].Id + '" onclick="checkanswer(' + resultData[i].Id + ',' + resultData[i].TopicType + ',' + strB + ')" />&nbsp;&nbsp;B</label></a><a  class="question-btn  ' + resultData[i].Id + '" id="lblC' + resultData[i].Id + '"><label for="rdC' + resultData[i].Id + '"><input type="checkbox" value="C"  name="rd' + resultData[i].Id + '"  id="rdC' + resultData[i].Id + '" onclick="checkanswer(' + resultData[i].Id + ',' + resultData[i].TopicType + ',' + strC + ')" />&nbsp;&nbsp;C</label></a><a  class="question-btn  ' + resultData[i].Id + '" id="lblD' + resultData[i].Id + '"><label for="rdD' + resultData[i].Id + '"><input type="checkbox" value="D"  name="rd' + resultData[i].Id + '"  id="rdD' + resultData[i].Id + '" onclick="checkanswer(' + resultData[i].Id + ',' + resultData[i].TopicType + ',' + strD + ')" /> &nbsp;&nbsp;D</label></a><a  class="question-btn  ' + resultData[i].Id + '" id="lblD' + resultData[i].Id + '"><label for="rdE' + resultData[i].Id + '"><input type="checkbox" value="E"  name="rd' + resultData[i].Id + '"  id="rdE' + resultData[i].Id + '" onclick="checkanswer(' + resultData[i].Id + ',' + resultData[i].TopicType + ',' + strE + ')" /> &nbsp;&nbsp;D</label></a></div></div><div class="clearfix"></div>';

                            }
                        }
                    }

                    if (resultData[0].t3 != 0) {
                        Str += '<b class="b1 bb1"></b><b class="b2 bb2"></b><b class="b3 bb2"></b><div class="bc bb2" ><div class="bt bb3 bc-h03"><span><a><img class="png" src="images/jian.png" /></a></span>第三部分：  判断题（每题1.00分,共' + (resultData[0].t3 * 1) + '分）</div></div ><b class="b3 bb2"></b><b class="b2 bb2"></b><b class="b1 bb1"></b>';
                        for (var i = 0; i < Object.keys(resultData).length; i++) {
                            if (resultData[i].TopicType == 3 && resultData[0].t3 != 0) {
                                Str += '<div class="m-choicebox" ><a name="21" class="target"></a><h4>第  ' + (i + 1) + '  题：<p>' + resultData[i].Topic + ' </p><p><img alt="" src="' + resultData[i].Img + '" /></p></h4><ul class="single"><li class="question-option-list"><span>A．</span><div class="option-content">正确</div></li><li class="question-option-list"><span>B．</span><div class="option-content">错误<br/></div></li></ul><div class="m-checkBox single"><a  class="question-btn ' + resultData[i].Id + '" id="lblA' + resultData[i].Id + '"><label for="rdA' + resultData[i].Id + '"><input type="radio" value="A"  name="rd' + resultData[i].Id + '"  id="rdA' + resultData[i].Id + '" onclick="checkanswer(' + resultData[i].Id + ',' + resultData[i].TopicType + ',' + strA + ')" /> &nbsp;&nbsp;A</label></a><a  class="question-btn ' + resultData[i].Id + '" id="lblB' + resultData[i].Id + '"><label for="rdB' + resultData[i].Id + '"><input type="radio" value="B"  name="rd' + resultData[i].Id + '"  id="rdB' + resultData[i].Id + '" onclick="checkanswer(' + resultData[i].Id + ',' + resultData[i].TopicType + ',' + strB + ')" />&nbsp;&nbsp;B</label></a></div></div><div class="clearfix"></div>';
                            }
                        }
                    }
                    $("#Content").append(Str)
                    $("#stuname").text(sessionStorage.getItem("AdminName"))
                    $("#totalscore").text(Number(resultData[0].t1) + Number(resultData[0].t2) + Number(resultData[0].t3))
                } else {
                    alert("本课程暂无习题")
                    location.href="../index.html"
                }
            }
        })
    }
    function GetExamitem(id) {
        var obj = {};
        obj.id = id
        $.ajax({
            url: '../../../Course/GetCourse1',
            type: 'get',
            data: obj,
            dataType: 'json',
            contentType: 'application/json',
            async: false,
            success: function (data) {
                var resultData = data;
                var Str = "";
                if (resultData[0].t1!=0) {
                    Str += '<h4>一、单选题</h4>';
                    for (var i = 0; i < Object.keys(resultData).length; i++) {
                        if (resultData[i].TopicType == 1) {
                            Str += ' <a href="#1" class="" id="num' + resultData[i].Id + '" name="num' + resultData[i].Id + '">' + (i + 1) + '</a>';
                        }
                    }
                    Str += '<div class="clearfix"></div>';
                }
                if (resultData[0].t2 != 0) {
                    Str += '<h4>二、多选题</h4>';
                    for (var i = 0; i < Object.keys(resultData).length; i++) {
                        if (resultData[i].TopicType == 2) {
                            Str += ' <a href="#1" class="" id="num' + resultData[i].Id + '" name="num' + resultData[i].Id + '">' + (i + 1) + '</a>';
                        }
                    }
                    Str += '<div class="clearfix"></div>';
                }
                if (resultData[0].t3 != 0) {
                    Str += '  <h4>三、判断题</h4>';
                    for (var i = 0; i < Object.keys(resultData).length; i++) {
                        if (resultData[i].TopicType == 3) {
                            Str += ' <a href="#1" class="" id="num' + resultData[i].Id + '" name="num' + resultData[i].Id + '">' + (i + 1) + '</a>';
                        }
                    }
                    Str += '<div class="clearfix"></div>';
                }

                $("#testnum").append(Str);
            }
        })
    }
    //function checkanswer(QuestionID, choosetype, choose) {
    //    var mychoose = $('input[name="rd' + QuestionID + '"]:checked'); //获取选中值
    //    if (choosetype == 2) {//复选
    //        if ($("#lbl" + choose + QuestionID).attr('class').indexOf('mus') > 0) {//若原来是选中模式
    //            $("#lbl" + choose + QuestionID).removeClass('mus');//去掉选中样式
    //        } else {//若原来非选中模式
    //            $("#lbl" + choose + QuestionID).addClass('mus');//添加选中模式
    //        }
    //    } else if (choosetype == 4) {        //主观题
    //        if ($("#rd" + QuestionID).val() == "") {
    //            $("#num" + QuestionID).removeClass("bg-blue"); //若没有选中项则清除样式
    //        } else {
    //            $("#num" + QuestionID).addClass("bg-blue"); //若本题有选中项则添加样式
    //        }
    //    }
    //    else {
    //        $("#lbl" + choose + QuestionID).addClass('mus').siblings().removeClass('mus'); //单选模式，除了选中那个其他的样式清除
    //    }
    //    if (choosetype != 4) {
    //        if (mychoose.length > 0) {
    //            $("#num" + QuestionID).addClass("bg-blue"); //若本题有选中项则添加样式
    //        } else {
    //            $("#num" + QuestionID).removeClass("bg-blue"); //若没有选中项则清除样式
    //        }
    //    }

    //}
</script>